<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <%@ include file="/common/CimsCommon.jsp" %>
   <title>新增风险金</title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <script type="text/javascript" src="${basePath}/js/cims/creditManage/queryTCMmRiskFund.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/cims/publicJs/importContract.js"></script>
</head>
  
<body style="background-color:#FFFFFF">
<div id="formPageSwap">
<form id="addNewsFormData" name="addNewsFormData" isCheck="true" action="com.jy.modules.cims.common.controller.TCMmRiskFundController">
	<div class="expandSwap">
		<div class="ui-widget-header ui-corner-all">
			<span class="text">合约信息</span><span class="expandBtn"></span>
		</div>
		<div class="expandContent">
		 <input type="button" id="importContract" value="导入合约" style="margin-bottom:10px;" onclick=""/>
			 <table id="addNewsTableId" class="formTableSwap" border="0" align="center" cellpadding="0" cellspacing="1" >
				<tr>
				
				  <th> 合作机构 ：</th>
				  <td > 
					  <input type="text" class="text" id="dtocooperorgCode" name="cooperorgCode" notNull="false" value="${dto.cooperorgCode}" readonly/>
				  </td>
				  <th> 协议名称：</th>
				  <td >
				     <input type="hidden" class="text" id="dtoagreementName" name="agreementName" notNull="false" value="${dto.agreementName}" />
				 	 <input type="text" class="text" id="dtoagreementCode" name="agreementCode" notNull="false" value="${dto.agreementCode}" />
				  </td>
				  <th> 合约名称：</th>
				  <td > 
				     <input type="hidden" class="text" id="dtocontractName" name="contractName" notNull="false" value="${dto.contractName}" />
				 	 <input type="text" class="text" id="dtocontractCode" name=contractCode notNull="false" value="${dto.contractCode}" />
				  </td>
				</tr>
				<tr>
				  <th> 发起方 ：</th>
				  <td > 
				  <input  type="text" class="text" id="dtoinitiator" name="initiator"   value="${dto.initiator}" />
				  </td>
				  <th> 接收方：</th>
				  <td colspan="3"> 
				  <input type="text" class="text" id="dtoreceiver" name="receiver"  value="${dto.receiver}" />
				  </td>
				</tr>
				<tr>
				  <th> 付款方 ：</th>
				  <td > 
				  <input type="text" class="text" id="dtopayer" name="payer"  value="${dto.payer}" />
				  </td>
				  <th> 收款方 ：</th>
				  <td colspan="3"> 
				  <input  type="text" class="text" id="dtogathering" name="gathering"  value="${dto.gathering}" />
				  </td>
				</tr>
         </table>
		</div>
		<div class="ui-widget-header ui-corner-all">
			<span class="text">债权信息</span><span class="expandBtn"></span>
		</div>
		<div class="expandContent">
	        <div id="jytableToolbar" class="tableToolbar" >
	            <a href="javascript:void(0)" onclick="initCreditDetailFn();" index="0">查询债权</a>
			    <a href="javascript:void(0)" onclick="toAddData()" index="1">试算</a>
			  	<a href="javascript:void(0)" onclick="toUpdateData()" index="2">导出</a>
	        </div>
			 <div id="creditDetailTable">
		      <%@include file="../creditManage/tCMmCreditDetail.jsp" %>
	         </div>
		</div>
		<div class="ui-widget-header ui-corner-all">
			<span class="text">结算信息</span><span class="expandBtn"></span>
		</div>
		<div class="expandContent">
			 <table id="addNewsTableId" class="formTableSwap" border="0" align="center" cellpadding="0" cellspacing="1" >
				<tr>
				  <th> 试算风险金额 ：</th>
				  <td > 
					  <input type="text" class="text" id="ex_riskFundSum" name="ex_riskFundSum" notNull="false" value="" />
				  </td>
				  <th> 实际金额：</th>
				  <td>
				  	<input type="text" class="text" id="dtoriskFundDetailSum" name=riskFundDetailSum notNull="false" value="${dto.riskFundDetailSum}"  />
				  </td>
				    <th> 返还金额：</th>
				  <td>
                    <input type="text" class="text" id="dtoreturnSum" name="returnSum" notNull="false" value="${dto.returnSum}" />
				  </td>
				</tr>
				
         </table>
		</div>
		<div class="expandToolbar">
			<span class="submitBtn" onclick="doAddFrom();">提交</span>
			<span class="submitBtn" onclick="parent.tabs.close();">关闭</span>
		</div>
	</div>
<!-- 保存 关闭 按钮 在 查询页面进行控制 -->  
</form>

</div>

</body>

<script type="text/javascript">

   $(document).ready(function(){
   	checkedInit();
   	Cmm.util.dateInputInit("addNewsFormData");
   		var importBtn=$("#importContract");
   		importBtn.on("click",importContract(function(contractCode){
   			var url=contextRootPath+"/tCMmQuota/queryOneContractAll?contractCode="+contractCode;
   			jyAjax(url,null,function(msg){
				//保存成功后，执行查询页面查询方法
				alert(msg.msg);
	        	var v_status = msg.status;
	        	if(v_status.indexOf('ok') >-1){
	        		var cdto=msg.data.cdto;
	        		$("input[name=contractCode]").val(cdto.contractCode);
	        		$("input[name=cooperorgCode]").val(cdto.cooperorgCode);
	        		$("input[name=agreementCode]").val(cdto.agreementCode);
	        		$("input[name=initiator]").val(cdto.initiator);
	        		$("input[name=receiver]").val(cdto.receiver);
	        		$("input[name=payer]").val(cdto.payer);
	        		$("input[name=gathering]").val(cdto.gathering);
	        		rebuildConstraintsEl({"contractCode":contractCode},"constraintContainer",
	        		contextRootPath+"/tCMmQuota/getContractConstraintHtml?contractCode="+contractCode);
	        	}
			});
   		}));
   	
	});
	
</script>
  
</html>
